<?php
namespace App\Http\Controllers\Game;

use App\Http\Controllers\Controller;
use App\Models\Game\ActionLogs;
use Illuminate\Http\Request;

class ActLogController extends Controller
{
    public function index() {
        return view('game/actlog/index');
    }

    public function data(Request $request) {
    
        $rows = $request->get("rows");

        $ActionLogs = new ActionLogs();
        $paginator = $this->filters($request, $ActionLogs)->orderBy($request->get("sidx"), $request->get("sord"))->paginate($rows);
    
        $rows = [];
        foreach ($paginator as $page) {
            $rows[] = $page;
        }
    
        $data = [
            'rows' => $rows,
            'total'=> $paginator->lastPage(),
            'page' => $paginator->currentPage(),
            'records' => $paginator->count(),
        ];
    
        return response()->json($data);
    }
}
